package com.example.neusoft.broadnotifytestflb307;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
private EditText et;
    private Button btn_send,btn_notify;
//    private View.OnClickListener clickListener=new View.OnClickListener() {
//        @Override
//        public void onClick(View v) {
//            switch (v.getId()){
//                case R.id.but_send:
//                    intent();
//                    break;
//                case R.id.activity_main:
//                    break;
//            }
//        }
//    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }
    public void init(){
        et=(EditText)findViewById(R.id.et);
        btn_send=(Button)findViewById(R.id.but_send);
        btn_notify=(Button)findViewById(R.id.btn_notify);
    }
    public void intent(){
        Intent intent=new Intent("com.example.tony.broadnotifytestzg308");
        String param=et.getText().toString();
        intent.putExtra("param1",param);
        sendBroadcast(intent);
    }
    public void Send(View view){
        intent();
    }
    public void Notify(View view){
        MyReceiver.manager.cancel(MyReceiver.notifyID);
    }
}
